package com.setting.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.report.entity.JsonReport;
import com.setting.entity.JsonUsed;
import com.setting.service.UsedService;
import com.utils.JsonResult;

/**   
* @Title: UsedController.java 
* @Package com.setting.controller 
* @author 孙梦楠 
* @date 2017年10月17日 下午7:47:14 
* @version V1.0.0   
*/
@RestController
@RequestMapping(value = "/used")
public class UsedController {
	
	@Autowired
	private UsedService usedservice;
	
	//电量总数和用户数
	
	@RequestMapping(value = "/count", method = RequestMethod.POST)
	public JsonResult<List<JsonUsed>> used(@RequestBody JsonReport JsonReport,
			@CookieValue(value = "opetypecookie", required = false) String opetypecookie,
			@CookieValue(value = "languagecookie", required = false) String languagecookie) {
		
		String org = JsonReport.getOrgvalue();
		String begintime = JsonReport.getBegintime();
		String endtime = JsonReport.getEndtime();
		
		
		return usedservice.areaUsedAndCustomerCount(org, opetypecookie, languagecookie, "F161_use", begintime, endtime);
	}
	
	//抄收成功率
	
		@RequestMapping(value = "/rate", method = RequestMethod.POST)
		public JsonResult<List<JsonUsed>> rate(@RequestBody JsonReport JsonReport,
				@CookieValue(value = "opetypecookie", required = false) String opetypecookie,
				@CookieValue(value = "languagecookie", required = false) String languagecookie) {
			
			String org = JsonReport.getOrgvalue();
			String time = JsonReport.getTime();
			
			
			return usedservice.successrate(org, opetypecookie, languagecookie, "F161", time);
		}
		

	
	

}
